<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">


    <ControlTemplate x:Key="RepeatButtonTemplate" TargetType="RepeatButton">
        <Grid x:Name="Root" Background="Transparent">
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualState x:Name="Normal" />
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
        </Grid>
    </ControlTemplate>

    <ControlTemplate x:Key="ScrollButtonLeftTemplate" TargetType="{x:Type RepeatButton}">
        <Grid Background="Transparent">
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualStateGroup.Transitions>
                        <VisualTransition GeneratedDuration="0:0:0.2" To="MouseOver" />
                        <VisualTransition From="MouseOver" GeneratedDuration="0:0:0.2" />
                        <VisualTransition GeneratedDuration="0:0:0.2" To="Pressed" />
                        <VisualTransition From="Pressed" GeneratedDuration="0:0:0.2" />
                    </VisualStateGroup.Transitions>
                    <VisualState x:Name="Disabled" />
                    <VisualState x:Name="Normal" />
                    <VisualState x:Name="MouseOver">
                        <Storyboard>
                            <ColorAnimation Duration="0" To="#FF8082AA" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="path" />
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Pressed">
                        <Storyboard>
                            <ColorAnimation Duration="0" To="#FF4A4C66" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="path" />
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Path x:Name="path" Data="F1 M 174,-113L 174,-119L 169,-116L 174,-113 Z " Fill="#FF676B81" Stretch="Fill" UseLayoutRounding="False" Width="5" Height="6" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="6,0" />
        </Grid>
    </ControlTemplate>
    <ControlTemplate x:Key="ScrollButtonUpTemplate" TargetType="{x:Type RepeatButton}">
        <Grid Background="Transparent">
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualStateGroup.Transitions>
                        <VisualTransition GeneratedDuration="0:0:0.2" To="MouseOver" />
                        <VisualTransition From="MouseOver" GeneratedDuration="0:0:0.2" />
                        <VisualTransition GeneratedDuration="0:0:0.2" To="Pressed" />
                        <VisualTransition From="Pressed" GeneratedDuration="0:0:0.2" />
                    </VisualStateGroup.Transitions>
                    <VisualState x:Name="Disabled" />
                    <VisualState x:Name="Normal" />
                    <VisualState x:Name="MouseOver">
                        <Storyboard>
                            <ColorAnimation Duration="0" To="#FF8082AA" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="path" />
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Pressed">
                        <Storyboard>
                            <ColorAnimation Duration="0" To="#FF4A4C66" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="path" />
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Path x:Name="path" Data="F1 M 113,174L 119,174L 116,169L 113,174 Z " Fill="#FF676B81" Stretch="Fill" UseLayoutRounding="False" Width="6" Height="5" VerticalAlignment="Top" HorizontalAlignment="Center" Margin="0,6" />
        </Grid>
    </ControlTemplate>
    <ControlTemplate x:Key="ScrollButtonDownTemplate" TargetType="{x:Type RepeatButton}">
        <Grid Background="Transparent">
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualStateGroup.Transitions>
                        <VisualTransition GeneratedDuration="0:0:0.2" To="Pressed" />
                        <VisualTransition From="Pressed" GeneratedDuration="0:0:0.2" />
                        <VisualTransition GeneratedDuration="0:0:0.2" To="MouseOver" />
                        <VisualTransition From="MouseOver" GeneratedDuration="0:0:0.2" />
                    </VisualStateGroup.Transitions>
                    <VisualState x:Name="Disabled" />
                    <VisualState x:Name="Normal" />
                    <VisualState x:Name="MouseOver">
                        <Storyboard>
                            <ColorAnimation Duration="0" To="#FF7F80A9" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="path" />
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Pressed">
                        <Storyboard>
                            <ColorAnimation Duration="0" To="#FF4A4C66" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="path" />
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Path x:Name="path" Data="F1 M 123,165L 129,165L 126,170L 123,165 Z " Fill="#FF676B81" Stretch="Fill" UseLayoutRounding="False" Width="6" Height="5" VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="0,6" />
        </Grid>
    </ControlTemplate>
    <ControlTemplate x:Key="ScrollButtonRightTemplate" TargetType="{x:Type RepeatButton}">
        <Grid Background="Transparent">
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualStateGroup.Transitions>
                        <VisualTransition GeneratedDuration="0:0:0.2" To="Pressed" />
                        <VisualTransition From="Pressed" GeneratedDuration="0:0:0.2" />
                        <VisualTransition GeneratedDuration="0:0:0.2" To="MouseOver" />
                        <VisualTransition From="MouseOver" GeneratedDuration="0:0:0.2" />
                    </VisualStateGroup.Transitions>
                    <VisualState x:Name="Disabled" />
                    <VisualState x:Name="Normal" />
                    <VisualState x:Name="MouseOver">
                        <Storyboard>
                            <ColorAnimation Duration="0" To="#FF7F80A9" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="path" />
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Pressed">
                        <Storyboard>
                            <ColorAnimation Duration="0" To="#FF4A4C66" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="path" />
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Path x:Name="path" Data="F1 M 165,-123L 165,-129L 170,-126L 165,-123 Z " Fill="#FF676B81" Stretch="Fill" UseLayoutRounding="False" Width="5" Height="6" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="6,0" />
        </Grid>
    </ControlTemplate>
    <ControlTemplate x:Key="ScrollThumbVertTemplate" TargetType="{x:Type Thumb}">
        <Grid>
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualStateGroup.Transitions>
                        <VisualTransition GeneratedDuration="0:0:0.2" To="MouseOver" />
                        <VisualTransition From="MouseOver" GeneratedDuration="0:0:0.2" />
                        <VisualTransition GeneratedDuration="0:0:0.2" To="Pressed" />
                        <VisualTransition From="Pressed" GeneratedDuration="0:0:0.2" />
                    </VisualStateGroup.Transitions>
                    <VisualState x:Name="Disabled" />
                    <VisualState x:Name="Normal" />
                    <VisualState x:Name="MouseOver">
                        <Storyboard>
                            <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Hover" />
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Pressed">
                        <Storyboard>
                            <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Select" />
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Border x:Name="Default" CornerRadius="4">
                <Border.Background>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FF262734" Offset="0" />
                        <GradientStop Color="#FF262733" Offset="1" />
                    </LinearGradientBrush>
                </Border.Background>
                <Border CornerRadius="3" Margin="1">
                    <Border.Background>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="#FF494A60" />
                            <GradientStop Color="#FF494A5E" Offset="1" />
                        </LinearGradientBrush>
                    </Border.Background>
                    <Border Margin="1" CornerRadius="2">
                        <Border.Background>
                            <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                                <GradientStop Color="#FF424256" Offset="0" />
                                <GradientStop Color="#FF3E4052" Offset="1" />
                            </LinearGradientBrush>
                        </Border.Background>
                    </Border>
                </Border>
            </Border>
            <Border x:Name="Hover" CornerRadius="4" Opacity="0">
                <Border.Background>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FF262734" Offset="0" />
                        <GradientStop Color="#FF262733" Offset="1" />
                    </LinearGradientBrush>
                </Border.Background>
                <Border CornerRadius="3" Margin="1">
                    <Border.Background>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="#FF5C5D79" />
                            <GradientStop Color="#FF545673" Offset="1" />
                        </LinearGradientBrush>
                    </Border.Background>
                    <Border Margin="1" CornerRadius="2">
                        <Border.Background>
                            <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                                <GradientStop Color="#FF50516C" Offset="0" />
                                <GradientStop Color="#FF4B4B68" Offset="1" />
                            </LinearGradientBrush>
                        </Border.Background>
                    </Border>
                </Border>
            </Border>
            <Border x:Name="Select" CornerRadius="4" Opacity="0">
                <Border.Background>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FF262734" Offset="0" />
                        <GradientStop Color="#FF262733" Offset="1" />
                    </LinearGradientBrush>
                </Border.Background>
                <Border CornerRadius="3" Margin="1">
                    <Border.Background>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="#FF4D4E66" />
                            <GradientStop Color="#FF454760" Offset="1" />
                        </LinearGradientBrush>
                    </Border.Background>
                    <Border Margin="1" CornerRadius="2">
                        <Border.Background>
                            <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                                <GradientStop Color="#FF3E3F55" Offset="0" />
                                <GradientStop Color="#FF393A52" Offset="1" />
                            </LinearGradientBrush>
                        </Border.Background>
                    </Border>
                </Border>
            </Border>
        </Grid>
    </ControlTemplate>
    <ControlTemplate x:Key="VertScrollBarTemplate" TargetType="{x:Type ScrollBar}">
        <Border CornerRadius="7">
            <Border.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FF3E404E" Offset="0" />
                    <GradientStop Color="#FF3D404E" Offset="1" />
                </LinearGradientBrush>
            </Border.Background>
            <Border Margin="1" CornerRadius="6">
                <Border.Background>
                    <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                        <GradientStop Color="#FF252731" Offset="0" />
                        <GradientStop Color="#FF2C2D3A" Offset="1" />
                    </LinearGradientBrush>
                </Border.Background>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <RepeatButton x:Name="up_button" Template="{StaticResource ScrollButtonUpTemplate}" Command="ScrollBar.LineUpCommand" />
                    <Track x:Name="PART_Track" Grid.Row="1" IsDirectionReversed="True">
                        <Track.DecreaseRepeatButton>
                            <RepeatButton Opacity="0" Command="ScrollBar.PageUpCommand" />
                        </Track.DecreaseRepeatButton>
                        <Track.IncreaseRepeatButton>
                            <RepeatButton Opacity="0" Command="ScrollBar.PageDownCommand" />
                        </Track.IncreaseRepeatButton>
                        <Track.Thumb>
                            <Thumb Template="{StaticResource ScrollThumbVertTemplate}" />
                        </Track.Thumb>
                    </Track>
                    <RepeatButton x:Name="down_button" Template="{StaticResource ScrollButtonDownTemplate}" Grid.Row="2" Command="ScrollBar.LineDownCommand" />
                </Grid>
            </Border>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Opacity" TargetName="up_button" Value="0.25" />
                <Setter Property="Opacity" TargetName="down_button" Value="0.25" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
    <ControlTemplate x:Key="HorzScrollBarTemplate" TargetType="{x:Type ScrollBar}">
        <Border CornerRadius="7">
            <Border.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FF3E404E" Offset="0" />
                    <GradientStop Color="#FF3D404E" Offset="1" />
                </LinearGradientBrush>
            </Border.Background>
            <Border Margin="1" CornerRadius="6">
                <Border.Background>
                    <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                        <GradientStop Color="#FF252731" Offset="0" />
                        <GradientStop Color="#FF2C2D3A" Offset="1" />
                    </LinearGradientBrush>
                </Border.Background>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    <RepeatButton x:Name="left_button" Template="{StaticResource ScrollButtonLeftTemplate}" Command="ScrollBar.LineLeftCommand" />
                    <Track x:Name="PART_Track" Grid.Column="1">
                        <Track.DecreaseRepeatButton>
                            <RepeatButton Opacity="0" Command="ScrollBar.PageLeftCommand" />
                        </Track.DecreaseRepeatButton>
                        <Track.IncreaseRepeatButton>
                            <RepeatButton Opacity="0" Command="ScrollBar.PageRightCommand" />
                        </Track.IncreaseRepeatButton>
                        <Track.Thumb>
                            <Thumb Template="{StaticResource ScrollThumbVertTemplate}" />
                        </Track.Thumb>
                    </Track>
                    <RepeatButton x:Name="right_button" Template="{StaticResource ScrollButtonRightTemplate}" Grid.Column="2" Command="ScrollBar.LineRightCommand" />
                </Grid>
            </Border>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Opacity" TargetName="left_button" Value="0.25" />
                <Setter Property="Opacity" TargetName="right_button" Value="0.25" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
    
    <Style TargetType="{x:Type ScrollBar}" BasedOn="{StaticResource {x:Type ScrollBar}}">
        <Style.Triggers>
            <Trigger Property="Orientation" Value="Vertical">
                <Setter Property="MinWidth" Value="0" />
                <Setter Property="Width" Value="12" />
                <Setter Property="Height" Value="Auto" />
                <Setter Property="MinHeight" Value="0" />
                <Setter Property="Template" Value="{StaticResource VertScrollBarTemplate}" />
            </Trigger>
            <Trigger Property="Orientation" Value="Horizontal">
                <Setter Property="MinHeight" Value="0" />
                <Setter Property="Height" Value="12" />
                <Setter Property="Width" Value="Auto" />
                <Setter Property="MinWidth" Value="0" />
                <Setter Property="Template" Value="{StaticResource HorzScrollBarTemplate}" />
            </Trigger>
        </Style.Triggers>
    </Style>
</ResourceDictionary>
